package com.dgut.sales.service;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dgut.sales.bean.Customer;
import com.dgut.sales.dao.CustomerDao;
import com.dgut.sales.dynamic.sql.bean.CustomerSearch;

@Service
public class CustomerService {
	
	@Autowired
	private CustomerDao dao;
	
	public Customer getCustomerById(Integer id) {
		return dao.getCustomerById(id);
	}
	
	public Customer getCustomerByName(String name) {
		return dao.getCustomerByName(name);
	}
	
	public List<Customer> getAllCustomer(){
		return dao.getAllCustomer();
	}
	
	public void addCustomer(Customer customer) {
		dao.addCustomer(customer);
	}

	public void update(Customer customer) {
		dao.updateCustomer(customer);
	}
	public void deleteCustomer(Integer id) {
		dao.deleteCustomer(id);
	}
	
	public List<Customer> searchCustomer(CustomerSearch customerSearch){
		return dao.SearchCustomer(customerSearch);
	}
	
	public List<Map<String, Object>> searchCustomerWithMoney(){
		return dao.SearchCustomerWithMoney();
	}
}
